package 常用类.day2.作业;

public class A implements Comparable{
    int id;
    int score;

    public A(int id, int score) {
        this.id = id;
        this.score = score;
    }

    @Override
    public String toString() {
        return "A{" +
                "id=" + id +
                ", score=" + score +
                '}';
    }

    @Override
    public int compareTo(Object o) {
        A a=(A)o;
        return score-a.score;//升序
        //return o.score-score//降序
    }
}
